/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.intersoft.sandbox.web.pub;

import hu.intersoft.sandbox.ejb.entity.News;
import hu.intersoft.sandbox.ejb.logic.SandboxManagerRemote;
import java.util.List;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author ntb
 */
public class Viewer {

    private SandboxManagerRemote manager = null;
    private Context ctx = null;
    private List<News> news = null;

    public List<News> getNews() {
        return news;
    }

    public void setNews(List<News> news) {
        this.news = news;
    }

    public Viewer() throws NamingException {
        ctx = new InitialContext();
        manager = (SandboxManagerRemote) ctx.lookup("SandboxManager/remote");
        listNews();
    }

    private void listNews(){
        news = manager.getNewsOrderByDate();
    }
    
}
